import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { Core } from "./core";
import { TransformInterceptor } from "./global/transform/transform.interceptor";
import { HttpExceptionFilter } from "./global/http-exception/http-exception.filter";
import { config } from 'dotenv';
// import './test';

// new TestService();

Core.ins.connect();

async function bootstrap() {
    config();
    const app = await NestFactory.create(AppModule);
    app.enableCors();
    app.useGlobalInterceptors(new TransformInterceptor());
    app.useGlobalFilters(new HttpExceptionFilter());
    await app.listen(3000);
}

bootstrap();

// const { cwd } = require('node:process');
// console.log(`Current directory: ${cwd()}`);

// const { exec } = require('child_process');

// const url = 'https://video.twimg.com/ext_tw_video/1494279082082775048/pu/vid/324x270/aMvpiOaEAMlIvlmb.mp4?tag=12';
// const outputFileName = '1.mp4';

// exec(`wget ${url} -O ${outputFileName}`, (error, stdout, stderr) => {
//     if (error) {
//         console.error(`执行错误： ${error}`);
//         return;
//     }
//     console.log(`stdout: ${stdout}`);
//     console.error(`stderr: ${stderr}`);
// });
